package cn.com.gridinfo.sooc.core.my.msg.activity;

import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.ImageView;

import com.jeremy.arad.Arad;
import com.jeremy.arad.utils.StringUtils;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import cn.com.gridinfo.sooc.R;
import cn.com.gridinfo.sooc.base.BaseSoocActivity;
import cn.com.gridinfo.sooc.common.LocalMark;
import cn.com.gridinfo.sooc.utils.MessageUtils;

/**
 * 消息推送详情-webview
 * Created by Michelle on 2016/2/23.
 */
public class NoticeDetailActivity extends BaseSoocActivity {

    @InjectView(R.id.my_msg_notice_detail)
    WebView noticeDetail;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.my_msg_activity_notice_detail);
        ButterKnife.inject(this);
        Intent intent = getIntent();
        String url = intent.getStringExtra("url");
        if(StringUtils.isNull(url)){
            //数据异常
            MessageUtils.showShortToast(NoticeDetailActivity.this,"详情暂时无法查看");
        }else {
            url = Arad.preferences.getString(LocalMark.SERVER_URL.getName()) + intent.getStringExtra("url");
            noticeDetail.getSettings().setJavaScriptEnabled(true);//允许脚本
            noticeDetail.loadUrl(url);
        }

    }
    //设置标题
    @Override
    public String setupToolBarTitle() {
        return "消息详情";
    }
    //设置左边按钮
    @Override
    public boolean setupToolBarLeftButton(ImageView leftButton) {
        return true;
    }
    //点击课程分类
    @OnClick(R.id.toolbar_leftbtn)
    void goBack(){
        finish();
    }
}
